
package com.bstek.urule.parse.deserializer;

import com.bstek.urule.model.decisiontree.DecisionTree;
import com.bstek.urule.parse.decisiontree.DecisionTreeParser;
import org.dom4j.Element;

/**
 * @author Jacky.gao
 * @since 2016年2月29日
 */
public class DecisionTreeDeserializer implements Deserializer<DecisionTree> {
    public static final String BEAN_ID = "urule.decisionTreeDeserializer";
    private DecisionTreeParser decisionTreeParser;

    @Override
    public DecisionTree deserialize(Element root) {
        return decisionTreeParser.parse(root);
    }

    public void setDecisionTreeParser(DecisionTreeParser decisionTreeParser) {
        this.decisionTreeParser = decisionTreeParser;
    }

    @Override
    public boolean support(Element root) {
        return decisionTreeParser.support(root.getName());
    }
}
